25. Solution: Add Scrolling Weather

Add Scrolling Weather Solution

In this exercise, you added a list of scrolling weather data.

Perhaps the trickiest part of this exercise was using findViewById. findViewById does exactly as the name implies: It gets a view from your XML layout by its ID, and stores it for you in a Java object, like this:

 mWeatherTextView = (TextView) findViewById(R.id.tv_weather_data);

Once you have this view, you can add everything in your weather array using the append method of the TextView class.

Another method you can use is setText. The difference between setText and append is that setText overwrites what was in the TextView, while append simply adds text onto whatever text was already there. For the solution code and a full diff showing the before and after states, check out the links below.

Solution Code

Solution: [S01.02-Solution-AddWeatherList][Diff]